<?php 

if(isset($_SESSION['user'])&&(isset($_GET['id']))){
  $id = $_GET['id'];
  $sql = 'update messages set like_num = like_num+1 where id=?';
  execute($sql,[$id]);
}

header('Location:'.url('index'));